home *** CD-ROM | disk | FTP | other *** search
/ The All American Girl Screen Saver / The All American Girl Screen Saver.img / SETUP.MS_ / SETUP.MS
Text File  |  1993-11-08  |  4KB  |  161 lines

  1. '**************************************************************************
  2. '*                       Setup Script File
  3. '**************************************************************************
  4.  
  5. '$DEFINE NODEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST WELCOME       = 100
  12. CONST ASKQUIT       = 200
  13. CONST DESTPATH      = 300
  14. CONST EXITFAILURE   = 400
  15. CONST EXITQUIT      = 600
  16. CONST EXITSUCCESS   = 700
  17. CONST OPTIONS       = 800
  18. CONST APPHELP       = 900
  19. CONST BADPATH       = 6400
  20.  
  21. ''Bitmap ID
  22. CONST LOGO = 1
  23.  
  24. GLOBAL DEST$        ''Default destination directory.
  25.  
  26. DECLARE SUB Install
  27. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  28.  
  29. INIT:
  30.     CUIDLL$ = "mscuistf.dll"            ''Custom user interface dll
  31.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  32.  
  33.     SetBitmap CUIDLL$, LOGO
  34.     SetTitle "The All American Girl Screen Saver Setup"
  35.  
  36.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  37.     IF szInf$ = "" THEN
  38.         szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
  39.     END IF
  40.     ReadInfFile szInf$
  41.  
  42. '$IFDEF DEBUG
  43.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  44.     WinDrive$ = MID$(GetWindowsDir, 1, 1)
  45.     IF IsDriveValid(WinDrive$) = 0 THEN
  46.         i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
  47.         GOTO QUIT
  48.     END IF
  49. '$ENDIF ''DEBUG
  50.  
  51.  
  52. WELCOME:
  53.     sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
  54.     IF sz$ = "CONTINUE" THEN
  55.         UIPop 1
  56.     ELSE
  57.         GOSUB ASKQUIT
  58.         GOTO WELCOME
  59.     END IF
  60.  
  61.     Install
  62.  
  63. QUIT:
  64.     ON ERROR GOTO ERRQUIT
  65.  
  66.     IF ERR = 0 THEN
  67.         dlg% = EXITSUCCESS
  68.     ELSEIF ERR = STFQUIT THEN
  69.         dlg% = EXITQUIT
  70.     ELSE
  71.         dlg% = EXITFAILURE
  72.     END IF
  73. QUITL1:
  74.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  75.     IF sz$ = "REACTIVATE" THEN
  76.         GOTO QUITL1
  77.     END IF
  78.     UIPop 1
  79.  
  80.     END
  81.  
  82. ERRQUIT:
  83.     i% = DoMsgBox("An error occurred during installation. The setup disk(s) may be damaged.", "Setup", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  84.     END
  85.  
  86.  
  87.  
  88. BADPATH:
  89.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  90.     IF sz$ = "REACTIVATE" THEN
  91.         GOTO BADPATH
  92.     END IF
  93.     UIPop 1
  94.     RETURN
  95.  
  96.  
  97.  
  98. ASKQUIT:
  99.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  100.  
  101.     IF sz$ = "EXIT" THEN
  102.         UIPopAll
  103.         ERROR STFQUIT
  104.     ELSEIF sz$ = "REACTIVATE" THEN
  105.         GOTO ASKQUIT
  106.     ELSE
  107.         UIPop 1
  108.     END IF
  109.     RETURN
  110.  
  111.  
  112.  
  113. '**
  114. '** Purpose:
  115. '**     Builds the copy list and performs all installation operations.
  116. '** Arguments:
  117. '**     none.
  118. '** Returns:
  119. '**     none.
  120. '*************************************************************************
  121. SUB Install STATIC
  122.  
  123.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  124.     DEST$ = GetWindowsDir()
  125.  
  126.     AddSectionFilesToCopyList "Files", SrcDir$, DEST$
  127.     nCursor% = ShowWaitCursor()
  128.     CopyFilesInCopyList
  129.     RestoreCursor(nCursor%)
  130.  
  131.     ini$ = MakePath(DEST$, "SYSTEM.INI")
  132.     CreateIniKeyValue ini$,"boot","SCRNSAVE.EXE",DEST$+"SSAAGIRL.SCR", cmoOverwrite
  133.     CreateIniKeyValue "WIN.INI","windows","ScreenSaveActive","1",cmoOverwrite
  134.  
  135. END SUB
  136.  
  137.  
  138.  
  139. '**
  140. '** Purpose:
  141. '**     Appends a file name to the end of a directory path,
  142. '**     inserting a backslash character as needed.
  143. '** Arguments:
  144. '**     szDir$  - full directory path (with optional ending "\")
  145. '**     szFile$ - filename to append to directory
  146. '** Returns:
  147. '**     Resulting fully qualified path name.
  148. '*************************************************************************
  149. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  150.     IF szDir$ = "" THEN
  151.         MakePath = szFile$
  152.     ELSEIF szFile$ = "" THEN
  153.         MakePath = szDir$
  154.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  155.         MakePath = szDir$ + szFile$
  156.     ELSE
  157.         MakePath = szDir$ + "\" + szFile$
  158.     END IF
  159. END FUNCTION
  160.  
  161.